import request from "@/service/request";
import {
  BubbleRequestType,
  BubbleStateOptionType,
  AnnularRequestType,
  AnnularResponseType,
  RadarRequestType,
  RadarResponseType,
  OperateSuportResponseType,
  OperateSuportRequestType,
  DeviceAccessRequestType,
  DeviceAccessResponseType,
  DeviceTotalRequestType,
  DeviceTotalResponseType,
  VersionDistributionRequestType,
  VersionDistributionResponseType,
  OnlineRateRequestType,
  OnlineRateResponseType,
} from "@/types/echartInterface";
//获取气泡图信息
export const queryBubbleCharts = async (
  params: BubbleRequestType
): Promise<BubbleStateOptionType> => {
  const url = `/api/charts/bubble`;
  const data = (await request.post(url, params)) as BubbleStateOptionType;
  return data;
};

//获取环形图信息
export const queryAnnularCharts = async (
  params: AnnularRequestType
): Promise<AnnularResponseType> => {
  const url = `/api/charts/annular`;
  const data = (await request.post(url, params)) as AnnularResponseType;
  return data;
};

//获取环形图信息
export const queryRadorCharts = async (
  params: RadarRequestType
): Promise<RadarResponseType> => {
  const url = `/api/charts/radar`;
  const data = (await request.post(url, params)) as RadarResponseType;
  return data;
};

//获取运维支撑的数据
export const queryOperateSupport = async (
  params: OperateSuportRequestType
): Promise<OperateSuportResponseType> => {
  const url = `/api/operateSupport`;
  const data = (await request.post(url, params)) as OperateSuportResponseType;
  return data;
};

//获取设备接入的数据
export const queryDeviceAccess = async (
  params: DeviceAccessRequestType
): Promise<DeviceAccessResponseType> => {
  const url = `/api/deviceAccess`;
  const data = (await request.post(url, params)) as DeviceAccessResponseType;
  return data;
};


//获取设备接入统计数据
export const queryDeviceTotal = async (
  params: DeviceTotalRequestType
): Promise<DeviceTotalResponseType> => {
  const url = `/api/deviceTotal`;
  const data = (await request.post(url, params)) as DeviceTotalResponseType;
  return data;
};


//获取版本分布
export const queryVersionDistribution = async (
  params: VersionDistributionRequestType
): Promise<VersionDistributionResponseType> => {
  const url = `/api/versionDist`;
  const data = (await request.post(url, params)) as VersionDistributionResponseType;
  return data;
};

//获取在线率趋势
export const queryOnlineRateTrend = async (
  params: OnlineRateRequestType
): Promise<OnlineRateResponseType> => {
  const url = `/api/onlineRate`;
  const data = (await request.post(url, params)) as OnlineRateResponseType;
  return data;
};